#include <stdio.h>
int Delect(int* num,int N,int ans){
    int count = 0;
    int k = 0;
    for(int i = 0; i < N - 1; i++){
        if(num[k] == ans){
            count++;
            for(int j = k; j < N - 1; j++){
                num[j] = num[j+1]; 
            }
            continue;
        }
        k++;
    }
    if(num[N-1] == ans) count++;
    return count;
}
int main(){
    int N;
    int num[50] = {0};
    int ans = 0;
    int count = 0;
    scanf("%d",&N);
    for(int i = 0; i < N; i++){
        scanf("%d",&num[i]);
    }
    scanf("%d",&ans);
    count = Delect(num,N,ans);
    for(int i = 0; i < N - count; i++){
        printf("%d ",num[i]);
    }
    return 0;
}
